import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;

public class StringExtractor {
    public static void main(String[] args) {
//        Scanner sc=new Scanner(Sy)
        try (BufferedReader reader = new BufferedReader(new FileReader("C:\\Users\\pc\\Desktop\\软件工程四java\\source_code.txt"))) {
            String line;
            while ((line = reader.readLine()) != null) {
                extractStrings(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void extractStrings(String line) {
        StringBuilder extractedString = new StringBuilder();
        boolean insideString = false;

        for (int i = 0; i < line.length(); i++) {
            char ch = line.charAt(i);
            if (ch == '"') {
                if (insideString) {
                    System.out.println(extractedString.toString());
                    extractedString.setLength(0);
                    insideString = false;
                } else {
                    insideString = true;
                }
            } else if (insideString) {
                if (ch == '\\') {
                    if (i < line.length() - 1) {
                        char nextChar = line.charAt(i + 1);
                        if (nextChar == '"' || nextChar == '\\') {
                            extractedString.append(nextChar);
                        } else {
                            extractedString.append(ch);
                            extractedString.append(nextChar);
                        }
                        i++; // Skip the next character
                    } else {
                        extractedString.append(ch);
                    }
                } else {
                    extractedString.append(ch);
                }
            }
        }
    }
}